package com.yxinsur.imc.business.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.ArrayList;
import java.util.List;

import com.yxinsur.imc.business.enums.IsDeletedEnum;
import com.yxinsur.imc.business.vo.AssessmentMetaVo;
import com.yxinsur.imc.common.utils.DateUtils;
import com.yxinsur.imc.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yxinsur.imc.business.mapper.ImcAssessmentMetaMapper;
import com.yxinsur.imc.business.domain.ImcAssessmentMeta;
import com.yxinsur.imc.business.service.IImcAssessmentMetaService;

/**
 * 考核元数据Service业务层处理
 * 
 * @author imc
 * @date 2021-06-10
 */
@Service
public class ImcAssessmentMetaServiceImpl extends ServiceImpl<ImcAssessmentMetaMapper, ImcAssessmentMeta> implements IImcAssessmentMetaService
{
    @Autowired
    private ImcAssessmentMetaMapper imcAssessmentMetaMapper;

    /**
     * 查询考核元数据列表
     *
     * @return 考核元数据集合
     */
    @Override
    public List<AssessmentMetaVo> selectAssessmentMetaList() {
        QueryWrapper<ImcAssessmentMeta> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("is_deleted", IsDeletedEnum.N.getCode());
        queryWrapper.eq("tenant_id", SecurityUtils.getTenantId());
        queryWrapper.orderByDesc("id");
        List<ImcAssessmentMeta> list = this.imcAssessmentMetaMapper.selectList(queryWrapper);
        List<AssessmentMetaVo> vos = new ArrayList<>();
        for (ImcAssessmentMeta meta:list) {
            vos.add(new AssessmentMetaVo(meta.getId(),meta.getAssName()));
        }
        return vos;
    }
}
